<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>打地鼠</title>
<style>
body{
    margin: 0;
    padding: 0;
    cursor: url("images/chuizi2.png"),auto;
}
    #tb{
        
    }
    #fen{
        font-weight:bold;
        font-size:60px;
    }
    #fen1{
        font-weight:bold;
        font-size:60px; 
    }
    .zt{
        font-weight:bold;
        font-size:60px;
    }
    td{
        width: 300px;
        height: 300px;
        border:1px solid #000;
        border-radius: 50%;
        text-align: center;
    }
    td>img{
        width: 200px;
    }
    .box{
        position: fixed;
        top: 300px;
        left:150px;
    }
</style>
</head>

<body onload="kaishi()">
<center>
    <table id="tb">
        
        <tr>
            <td><img src="images/1.png" draggable="false"></td>
            <td><img src="images/1.png" draggable="false"></td>
            <td><img src="images/1.png" draggable="false"></td>
        </tr>
        <tr>
            <td><img src="images/1.png" draggable="false"></td>
            <td><img src="images/1.png" draggable="false"></td>
            <td><img src="images/1.png" draggable="false"></td>
        </tr>
        <tr>
            <td><img src="images/1.png" draggable="false"></td>
            <td><img src="images/1.png" draggable="false"></td>
            <td><img src="images/1.png" draggable="false"></td>
        </tr>

    </table>
    <div class="box">
        <p class="zt">命中：<span id="fen">0</span></p>
        <p class="zt">得分：<span id="fen1">0</span></p>
    </div>
    <script>
    function kaishi(){
        setTimeout("bh()",3000);
        sum=0;
    }
    function bh(){    
        sj=Math.floor(Math.random()*9);
        var img1=document.getElementsByTagName("img");
        img1[sj].src="images/ds1.png";
        img1[sj].setAttribute("onclick","daji()");
        setTimeout("xs()",1000);
    }
    function daji(){
        var img1=document.getElementsByTagName("img");
        img1[sj].src="images/ds2.png";    
        img1[sj].removeAttribute("onclick");
        sum+=10;
        document.getElementById("fen").innerHTML=sum/10;
        document.getElementById("fen1").innerHTML=sum;
    }    
    function xs(){    
        var img1=document.getElementsByTagName("img");
        img1[sj].removeAttribute("onclick");
        img1[sj].src="images/1.png";    
        setTimeout("bh()",1000);            
    }

</script>
</center>
</body>
</html>